//
//  WSJLTabBarController.m
//  RunningMan
//
//  Created by dllo on 16/5/18.
//  Copyright © 2016年 WSJ. All rights reserved.
//

#import "WSJLTabBarController.h"
#import "WSJFindViewController.h"
#import "WSJSportCircleViewController.h"
#import "WSJSportViewController.h"


@interface WSJLTabBarController ()

@end

@implementation WSJLTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];


    [self creatViewController];
}
-(void)creatViewController{
    
    WSJFindViewController *find = [[WSJFindViewController alloc] init];
    WSJSportViewController *sportView = [[WSJSportViewController alloc] init];
    WSJSportCircleViewController *sportCircleView = [[WSJSportCircleViewController alloc] init];
    
    
    [self addChild:sportCircleView title:@"运动圈" image:@"sportCircle.png" imageSele:@"sportCircle.png"];
    [self addChild:find title:@"发现" image:@"find.png" imageSele:@"find.png"];
    [self addChild:sportView title:@"运动" image:@"sport.png" imageSele:@"sport.png"];
    
}

- (void)addChild:(UIViewController *)childVC
           title:(NSString *)title
           image:(NSString *)image
       imageSele:(NSString *)imageSele{
    
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVC];
    
    childVC.title = title;
    childVC.view.backgroundColor = [UIColor whiteColor];
    
    childVC.tabBarItem.image =  [UIImage imageNamed:image];
//    childVC.tabBarItem.selectedImage =  [[UIImage imageNamed:imageSele] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
//    childVC.navigationController.navigationBar.translucent = NO;

    // 导航栏  标题颜色
    [childVC.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20], NSForegroundColorAttributeName:[UIColor blueColor]}];
    
//    childVC.tabBarController.tabBar.translucent = NO;
    // 取消tabbar文字渲染效果,属性字符串
//    NSMutableDictionary *dicTemp = [NSMutableDictionary dictionary];
//    dicTemp[NSForegroundColorAttributeName]
//    = [UIColor lightGrayColor];
//    
//    NSMutableDictionary *dicTempTwo =
//    [NSMutableDictionary dictionary];
//    dicTempTwo[NSForegroundColorAttributeName]=
//    [UIColor orangeColor];
//    
//    [childVC.tabBarItem setTitleTextAttributes:dicTemp forState:UIControlStateNormal];
//    [childVC.tabBarItem setTitleTextAttributes:dicTempTwo forState:
//     UIControlStateSelected];
    
    [self addChildViewController:nav];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
